package org.mathcloud.math.core.scilab.operator.algebra;

import org.mathcloud.math.core.common.quantity.ComplexNumber;
import org.mathcloud.math.core.scilab.operator.ScilabUnaryOperator;
import org.mathcloud.math.core.scilab.quantity.ScilabRealNumber;

public class ScilabArg extends ScilabUnaryOperator
{
	public ScilabArg()
	{
		super();
		signature.setMMLContentTag("arg");
	}
	
	@Override
	public void calculate()
	{
		if (operand.getSignature().isRealNumberSignature())
			res = new ScilabRealNumber(0.0);
		else if (operand.getSignature().isComplexNumberSignature())
			res = new ScilabRealNumber(((ComplexNumber)operand).getArg());
	}
}
